<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title></title>
<%@ include file="/WEB-INF/views/include/easyui.jsp"%>
<script src="${ctx}/static/plugins/My97DatePicker/WdatePicker.js" type="text/javascript"></script>

</head>
<body style="font-family: '微软雅黑'">
<div id="tb" style="padding:5px;height:auto">
        <div>
        	<form id="searchFrom" action="">
       	        <input type="text" name="userName" class="easyui-validatebox" data-options="width:150,prompt: '姓名'"/>
				<input type="text" name="uid" class="easyui-validatebox" data-options="width:150,prompt: '用户名'"/>
       	        <input type="text" name="telephone" class="easyui-validatebox" data-options="width:150,prompt: '手机号'"/>
				<input type="text" name="idCardNO" class="easyui-validatebox" data-options="width:150,prompt: '身份证号'"/>
				<input type="text" name="lcsName" class="easyui-validatebox" data-options="width:150,prompt: '理财师姓名'"/>
				<input type="text" name="lcsCode" class="easyui-validatebox" data-options="width:150,prompt: '理财师编码'"/>
				<input type="text" name="beginDate" class="easyui-my97" datefmt="yyyy-MM-dd" data-options="width:150,prompt: '开始日期'"/>
				- <input type="text" name="endDate" class="easyui-my97" datefmt="yyyy-MM-dd" data-options="width:150,prompt: '结束日期'"/>
		        <span class="toolbar-item dialog-tool-separator"></span>
		        <a href="javascript(0)" class="easyui-linkbutton" iconCls="icon-search" plain="true" onclick="cx()">查询</a>
				<shiro:hasPermission name="lcs:customer:update">
					<a href="#" class="easyui-linkbutton" plain="true" iconCls="icon-edit" onclick="upd()">修改</a>
				</shiro:hasPermission>
			</form>
        </div> 
        
</div>
<table id="dg"></table> 
<div id="dlg"></div>  
<script type="text/javascript">
var dg;
$(function(){   
	dg=$('#dg').datagrid({    
	method: "get",
    url:'${ctx}/customer/json',

    fit : true,
	fitColumns : true,
	border : false,
	striped:true,
	idField : 'id',
	pagination:true,
	rownumbers:true,
	pageNumber:1,
	pageSize : 20,
	pageList : [ 10, 20, 30, 40, 50 ],
	singleSelect:true,
	sortRemote:false,
	queryParams:{
		sort: 'createTime',
		order: 'desc'
	},
    columns:[[
		{field:'id',title:'id',hidden:true},
		{field:'trueName',title:'姓名',align:'center',sortable:false,width:50},
		{field:'uid',title:'用户名',align:'center',sortable:false,width:50},
		{field:'userTel',title:'手机号',align:'center',sortable:false,width:60},
		{field:'lcsCode',title:'理财师编码',align:'center',sortable:false,width:50,formatter : function(value, row, index) {
			if(row.userInfo==null)
			{
				return "";	
			}
			else if(row.userInfo.uid==null)
			{
				return "";
			}
			return row.userInfo.uid;
		}},
		{field:'lcsName',title:'理财师姓名',align:'center',sortable:false,width:50,formatter : function(value, row, index) {
			if(row.userInfo==null)
			{
				return "";	
			}
			else if(row.userInfo.userName==null)
			{
				return "";
			}
			return row.userInfo.userName;
		}},
		{field:'identityVerify',title:'是否实名认证',align:'center',sortable:false,width:50,formatter:function(value,rowData,rowIndex){
			if(value == '1') {
				return "<span>是</span>";
			} else {
				return "<span>否</span>";
			}
		}},
		{field:'recordTime',title:'注册时间',align:'center',sortable:false,width:80,formatter : function(value, row, index) {
			return formatTime(value);
		}} 
    ]],
    enableHeaderClickMenu: false,
    enableHeaderContextMenu: false,
    enableRowContextMenu: false,
    toolbar:'#tb'
	});
});

//创建查询对象并查询
function cx(){
	var obj=$("#searchFrom").serializeObject();
	obj.userName = encodeURIComponent(obj.userName);
	obj.city = encodeURIComponent(obj.city);
	obj.lcsName = encodeURIComponent(obj.lcsName);
	dg.datagrid('reload',obj); 
}
//修改
function upd(){
	var row = dg.treegrid('getSelected');
	if(rowIsNull(row)) return;
	//父级权限
	parentPermId=row.pid;
	d=$("#dlg").dialog({
		title: '修改菜单',
		width: 300,
		height: 140,
		href:'${ctx}/customer/update/'+row.id,
		maximizable:true,
		modal:true,
		buttons:[{
			text:'确认',
			handler:function(){
				$("#mainform").submit();
			}
		},{
			text:'取消',
			handler:function(){
				d.panel('close');
			}
		}]
	});

}
</script>
</body>
</html>